<include file="../header" />
<body class="J_scroll_fixed">
<script>

        $(document).ready(function() {

            $('button.buy').click(function () {

                var id = $(this).attr("id");
                layer.open({

                    type: 2,
                    title: '续费',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['80%', '98%'],
                    content: "{:U('company/buy')}&id="+id

                });
            });
             $('button.train').click(function () {

                var id = $(this).attr("id");
                layer.open({

                    type: 2,
                    title: '我要锻炼',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['80%', '98%'],
                    content: "{:U('Company/train')}&id="+id

                });
            });
            $('button.viewRecord').click(function () {

                var id = $(this).attr("id");
                layer.open({

                    type: 2,
                    title: '查看',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['80%', '98%'],
                    content: "{:U('company/viewRecord')}&id="+id

                });
            });
       
            $('button.viewOrder').click(function () {

                var id = $(this).attr("id");
                layer.open({

                    type: 2,
                    title: '查看',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['80%', '98%'],
                    content: "{:U('company/viewOrder')}&id="+id

                });
            });
            $('button.viewStaff').click(function () {

                var id = $(this).attr("id");
                layer.open({

                    type: 2,
                    title: '查看',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['80%', '98%'],
                    content: "{:U('companyStaff/viewStaff')}&id="+id

                });
            });
            
        });

    </script>
<form class="well form-search" method="post" style="float:left;width:100%;" action="{:U('company/index')}">
    <div class="search_type cc mb10">
        <div class="mb10">
        <span class="mr20">
            店&nbsp;&nbsp;&nbsp;&nbsp;铺：{:getShopSelectHtml($shopId,1)}
                    公司名称：
        <input type="text" name="companyName" class="input" value="{$companyName}" />
            <button class="btn btn-primary">搜索</button>
            <a class="btn" href="{:U('company/index')}">重置</a>
        </span>
        </div>
    </div>
</form>
<div class="wrap J_check_wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:U('company/add')}">添加公司</a></li>
    </ul>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th>编号</th>
            <th>公司名称</th>
            <th>所在店铺</th>
            <th>联系方式</th>
            <th>地址</th>
            <th>剩余卡次</th>
            <th>创建时间</th>
            <th>员工</th>
            <th>续费</th>
            <th>锻炼</th>
            <th>锻炼记录</th>
            <th>购买记录</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="list" item="vo">
            <tr>
                <td>{$vo.company_id}</td>
                <td>{$vo.company_name}</td>
                <td>{$vo.shop_name}</td>
                <td>{$vo.mobile}</td>
                <td>{$vo.address}</td>
                <td>
                    <if condition="$vo['left_number'] eq NULL">0 次
                    <else/>{$vo.left_number} 次
                    </if>
                </td>
                <td>{$vo.create_time}</td>
                <td><button class="viewStaff btn" id="{$vo['company_id']}">查看</button></td>
                <td><button class="buy btn" id="{$vo['company_id']}">续费</button></td>                
                <td><button class="train btn" id="{$vo['company_id']}">锻炼</button></td>
                <td><button class="viewRecord btn" id="{$vo['company_id']}">查看</button></td>
                <td><button class="viewOrder btn" id="{$vo['company_id']}">查看</button></td>               
                <td>
                    <a href='{:U("company/edit",array("id"=>$vo["company_id"]))}'>修改</a> |
                    <a class="J_ajax_del" href="{:U('company/delete',array('id'=>$vo['company_id']))}">删除</a>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page}</div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>